package com.flyduck.common.vo;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * @program: flyduck-platform
 * @description:
 * @author: flyduck
 * @create: 2021-01-31 21:19
 **/
@Data
@NoArgsConstructor
public class PageResult<E>  implements Serializable {
    private static final long serialVersionUID = 1L;

    private List<E> rows;

    private Long total;

    public static <E,P> PageResult<E> ofPages(List<E> rows, IPage<P> iPage){
        PageResult<E> result = new PageResult<>();
        result.setRows(rows);
        result.setTotal(iPage.getTotal());
        return result;
    }
}

